package com.syuchen.protocol.http;

public class HttpRequestEncoder {

    /**
     * 将请求编码为HTTP请求报文
     */
    public static String encode(String apiUrl, String host, String content) {
        return "POST " + apiUrl + " HTTP/1.1\r\n" +
                "Host: " + host + "\r\n" +
                "Content-Type: application/json;charset=utf-8\r\n" +
                "Content-Length: " + content.length() + "\r\n" +
                "\r\n" +
                content;
    }

}
